<?php
/**
 * Here is your custom functions.
 */

if (!function_exists('app')) {
    function app($name) {
        return \support\bootstrap\Container::get($name);
    }
}

if (!function_exists('cdnurl')) {
    function cdnurl($url, $domain = false) {
        $url .= ( strpos("?", $url) ? '&' : '?' ) . 'version=' . get_version();
        if ($domain) {
            $url = request()->host(true) . $url;
        }
        return $url;
    }
}

if (!function_exists('admin_theme_get')) {
    function admin_theme_get() {
        return 'pear';
    }
}

if (!function_exists('admin_theme_url')) {
    function admin_theme_url($url, $domain = false) {
        return cdnurl('/assets/admin/' . admin_theme_get() . '/' . $url, $domain);
    }
}


if (!function_exists('admin_can')) {
    function admin_can($path) {
        $auth = app(\app\admin\service\Auth::class);
        return $auth->can($path);
    }
}
